<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增厂商信息管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-factory-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">厂商名称：</label>
                <div class="col-sm-8">
                    <input name="factoryName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">厂商代码：</label>
                <div class="col-sm-8">
                    <input id="factoryCode" name="factoryCode" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂商地址：</label>
                <div class="col-sm-8">
                    <input name="factoryAddress" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">厂商网址：</label>
                <div class="col-sm-8">
                    <input name="factoryWebsite" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂商电话：</label>
                <div class="col-sm-8">
                    <input name="factoryPhone" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">邮政编码：</label>
                <div class="col-sm-8">
                    <input name="factoryPostal" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">电子邮件：</label>
                <div class="col-sm-8">
                    <input name="factoryEmail" class="form-control email" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系人：</label>
                <div class="col-sm-8">
                    <input name="factoryLiaison" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系人电话：</label>
                <div class="col-sm-8">
                    <input name="factoryContact" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">设备采集代号：</label>
                <div class="col-sm-8">
                    <input name="factoryNumber" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea id="remark" name="remark" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "module/factory"
        $("#form-factory-add").validate({
            onkeyup: false,
            rules: {
                configKey: {
                    remote: {
                        url: prefix + "/checkFactoryCodeUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                            "factoryCode": function() {
                                return $.common.trim($("#factoryCode").val());
                            }
                        },
                        dataFilter: function(data, type) {
                            return $.validate.unique(data);
                        }
                    }
                },
            },
            messages: {
                "factoryCode": {
                    remote: "厂商代码已存在"
                }
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-factory-add').serialize());
            }
        }
    </script>
</body>
</html>